// utils/eventBus.js
// 用于绑定发送吐槽圈返回自动刷新事件
export default {
    listeners: {},
    
    on(event, fn) {
      (this.listeners[event] || (this.listeners[event] = [])).push(fn)
      return fn // 返回引用用于解绑
    },
    
    off(event, fn) {
      const index = (this.listeners[event] || []).indexOf(fn)
      if (index > -1) this.listeners[event].splice(index, 1)
    },
    
    emit(event, ...args) {
      (this.listeners[event] || []).forEach(fn => fn(...args))
    }
  }